__________________________________________________________________________________________________
class Solution {
public:
    int ordinalOfDate(string date) {
        int y,m,d,i,ans=0;
        y=m=d=0;
        for(i=0;i<4;i++)y=y*10+date[i]-'0';
        for(i=5;i<7;i++)m=m*10+date[i]-'0';
        for(i=8;i<10;i++)d=d*10+date[i]-'0';
        int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
        if(y%400==0||y%4==0&&y%100!=0)a[2]++;
        for(i=1;i<m;i++)ans+=a[i];
        return ans+d;
    }
};
__________________________________________________________________________________________________

__________________________________________________________________________________________________
